package com.shop.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.shop.pojo.wms.Wms_Purchase;
import com.shop.service.Wms_Purchase_Service;
import com.shop.utils.CaiGouVo;
import com.shop.utils.LayuiUtils;
import com.shop.utils.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * 采购单—李贝贝
 */
@RestController
@RequestMapping("/purchase")
public class Wms_Purchase_Controller {

    @Autowired
    private Wms_Purchase_Service wms_purchase_service;




    /***
     *
     * 后台合并采购单
     */
    @PostMapping("/CaiGou_admin_HeBIn_All")
    public R CaiGou_admin_HeBIn_All(CaiGouVo caiGouVo){

        return wms_purchase_service.CaiGou_admin_HeBIn_All(caiGouVo);
    }


    /**
     * 显示所有采购单
     * @param page
     * @param limit
     * @param wms_purchase
     * @return
     */
    @GetMapping("/find_All_Purchase")
    public LayuiUtils<Wms_Purchase> find_All_Purchase(Integer page,Integer limit, Wms_Purchase wms_purchase){
        Page<Wms_Purchase> pages = new Page<>(page,limit);
        return wms_purchase_service.find_all_pruchase(pages,wms_purchase);
    }

    /**
     * 新增采购单
     * @param wms_purchase
     * @return
     */
    @PostMapping("/insert_Purchase")
    public R insert_Purchase(@RequestBody Wms_Purchase wms_purchase){
        return wms_purchase_service.insert_purchase(wms_purchase);
    }

    /**
     * 删除
     * @param id
     * @return
     */
    @DeleteMapping("/delete_Purchase")
    public R delete_Purchase(@RequestParam List<Long> id){
        return wms_purchase_service.delete_purchase(id);
    }

    /**
     * 修改
     * @param wms_purchase
     * @return
     */
    @PutMapping("/update_Purchase")
    public R update_Purchase(@RequestBody Wms_Purchase wms_purchase){
        return wms_purchase_service.update_purchase(wms_purchase);
    }




}
